package nels4561;

import java.util.Random;

/**
 * A synapse that connects two neurons together
 * and holds a weight that is to be evolved
 * 
 * @author Michael
 */
public class Synapse {
	
	/**
	 * The input Neuron
	 */
	private Neuron in;
	/**
	 * The output Neuron
	 */
	private Neuron out;
	/**
	 * The weight
	 */
	private double weight;
	
	
	/**
	 * The constructor, sets the input and output
	 * Neuron and randomly initialized the weight
	 * @param in
	 * @param out
	 */
	public Synapse(Neuron in, Neuron out)
	{
		this.in = in;
		this.out = out;
		weight = new Random().nextDouble();
	}

	/**
	 * Getter for the input neuron's output
	 * @return
	 */
	public double getInOutput()
	{
		return in.getOutput();
	}
	
	/**
	 * Getter for the output neuron's output
	 * @return
	 */
	public double getOutOutPut()
	{
		return out.getOutput();
	}
	
	/**
	 * Getter for the weight
	 * @return
	 */
	public double getWeight()
	{
		return weight;
	}
	
	/**
	 * Setter for the weight
	 * @param newWeight
	 */
	public void setWeight(double newWeight)
	{
		weight = newWeight;
	}
	
}
